﻿using MediatR;
using T.Materials.Domain.Model;
using T.Materials.Read.API.ApplicationRead.Command.ApprovalRecordCommand;
using T.Materials.Repository.MaterialsInterface;

namespace T.Materials.Read.API.ApplicationRead.CommandHandler.ApprovalRecordCommandHandler
{
    public class Appplistdsd : IRequestHandler<Approowlist, List<MApproval>>
    {
        private readonly IMApprow _happroval;

        public Appplistdsd(IMApprow happroval)
        {
            _happroval = happroval;
        }

        public async Task<List<MApproval>> Handle(Approowlist request, CancellationToken cancellationToken)
        {
            return await _happroval.GetAsync(d => !d.IsDeleted && d.CompanyID == request.CompanyID && d.MaterialStoreId == request.materialStoreId);
        }
    }
}
